#ifndef SCT_RTSPSERVER_SERVERINTERFACE_H
#define SCT_RTSPSERVER_SERVERINTERFACE_H

#include "sct/core/common.h"

namespace sct
{
class CServerInterface
{
public:
	CServerInterface()
	{
		mBasePts = 0;
		mSyncSourcePts = -1;
	}
	virtual ~CServerInterface() {}

	void resetPTS()
	{
		mBasePts = 0;
		mSyncSourcePts = -1;
	}

	int64_t getPTS(const int64_t & pts)
	{
		if(-1 == mSyncSourcePts)
		{
			mSyncSourcePts = pts;
			mBasePts = currentTime()*1000000;
			SCT_LOGD("sync pts:%lld %lld", mSyncSourcePts, mBasePts);
		}

		return mBasePts + (pts - mSyncSourcePts);
	}


	virtual bool needStopStream() {return true;}

protected:
	int64_t mBasePts;
	int64_t mSyncSourcePts;
};

}

#endif
